<template>
    <div>
         <h3>管理员管理</h3>
         <table border="1" width="100%">
            <thead>
                <th>管理员ID</th>
                <th>名称</th>
                <th>年龄</th>
                <th>操作</th>
            </thead>
            <tbody>
                <tr v-for="(item,index) in lists" :key="index">
                    <td>{{item.id}}</td>
                    <td>{{item.name}}</td>
                    <td>{{item.age}}</td>
                    <td>
                        <button>编辑</button>|
                        <button @click="del(index)">删除</button>
                    </td>
                </tr>
            </tbody>
        </table>
    <p>共有{{count}}条记录</p>
    </div>
</template>
<script>


export default {
   data(){
       return{
           lists:[],
           page:1
       }
   },
   methods:{
       async getglylist(){
              let res = await this.$http.get('/exam/getstudent',{params:{pageSize:5,page:this.page}})
            //  console.log(res);
             if(res.code=='00000'){
                  this.lists=res.data
              }
           },
           del(index){
               this.lists.splice(index,1);
           }
   },
   computed:{
       count(){
           return this.lists.length
       }
   },
   mounted(){
       this.getglylist()
   }
}
</script>


<style scoped>


    table{
        text-align: center;
    }
</style>